package io.github.weiranyi.feign;

import io.github.weiranyi.feign.fallback.ProductFeignFallBack;
import io.github.weiranyi.pojo.Product;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

// 自定义的Feig接口，调用商品微服务的方法都在此定义 Spring2以后要求@FeignClient的名字只能出现一次
@FeignClient(name = "weiranyi-service-product",fallback = ProductFeignFallBack.class)
public interface ProductFeign {

    @RequestMapping("/product/query/{id}")
    Product query(@PathVariable Integer id);

    @RequestMapping("/serverinfo/getport")
    String getPort();
}
